package com.lccviolet;

import java.util.concurrent.TimeUnit;

/**
 * @author LiChaochao
 * @Date 2021/10/4 12:08
 * @Description 不能创建更多线程异常：unable to create new native thread
 *
 * 需要在Linux环境下运行该代码
 */
public class UnableCreateNewThreadDemo {

    public static void main(String[] args) {
        for (int i = 1; ; i++) {
            System.out.println("*****************i = " + i);

            new Thread(() -> {
                try {
                    TimeUnit.SECONDS.sleep(Integer.MAX_VALUE);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                };
            }, "" + i).start();
        }
    }
}
